//
//  ZDPayResultController.m
//  特种车调度
//
//  Created by 陈宇 on 15/8/31.
//
//

#import "ZDPayResultController.h"
#import "ZDOrderController.h"

@interface ZDPayResultController ()

@property (weak, nonatomic) IBOutlet UIImageView *statusIcon;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
@property (weak, nonatomic) IBOutlet UIButton *button1;
@property (weak, nonatomic) IBOutlet UIButton *button2;

- (IBAction)buttonAction:(UIButton *)sender;

@end

@implementation ZDPayResultController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    if (_success) {
        self.title = @"充值成功";
        _statusIcon.image = [UIImage imageNamed:@"pay_success"];
        _statusLabel.text = @"充值成功";
    } else {
        self.title = @"充值失败";
        _statusIcon.image = [UIImage imageNamed:@"pay_fail"];
        _statusLabel.text = @"充值失败";
        [_button2 setTitle:@"重新充值" forState:UIControlStateNormal];
    }
}

- (IBAction)buttonAction:(UIButton *)sender {
    if (sender.tag) {
        if (_success) {
            [self showHint:@"继续充值"];
        } else {
            [self showHint:@"重新充值"];
        }
    } else {
        ZDOrderController *orderVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"orderVC"];
        [self showViewController:orderVC sender:nil];
    }
}

@end
